package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28779
 * Date: 2023-04-24
 * Time: 11:26
 */
public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();

        binaryTree.preOrder(root);
        System.out.println();
        binaryTree.inOrder(root);
        System.out.println();
        binaryTree.postOrder(root);
        System.out.println();

        System.out.println("节点个数为：" + binaryTree.size1(root));
        System.out.println("节点个数为：" + binaryTree.size2(root));

        System.out.println("叶子节点个数为：" + binaryTree.getLeafNodeCount1(root));
        System.out.println("叶子节点个数为：" + binaryTree.getLeafNodeCount2(root));

        System.out.println("第k层节点个数为：" + binaryTree.getKLevelNodeCount(root, 2));

        System.out.println("树的深度为：" + binaryTree.getHeight(root));

        System.out.println("有无指定节点：" + binaryTree.find(root, 'W'));

        System.out.println("=========层序遍历=========");
        binaryTree.levelOrder(root);

        System.out.println("=========判断完全二叉树=========");
        System.out.println(binaryTree.isCompleteTree(root));

        System.out.println("=======无递归前序打印二叉树=======");
        binaryTree.prePrint(root);
        System.out.println();

        System.out.println("=======无递归中序打印二叉树========");
        binaryTree.inPrint(root);
        System.out.println();

        System.out.println("=======无递归中序打印二叉树========");
        binaryTree.postPrint(root);
        System.out.println();

    }
}
